function XMLRequest(url){
    this.url = url;
    this.xmlHttp = XMLRequest.getXmlHttpObject();   
}

/**
* params - Map of params to be added to query string
* isAsync - async flag, defaults to true. Set to false to make use SJAX instead of AJAX.
*/
XMLRequest.prototype.get = function (params, isAsync) {
    if (!Utils.isDefined(isAsync)) {
        isAsync = true;
    }
    this.xmlHttp.open("GET", Utils.buildQueryString(this.url, params) , isAsync);
    this.xmlHttp.send(null);
}

/**
* params - Map of parameters to be added to query string
* body - HTTP request body
* isAsync - async flag, defaults to true. Set to false to make use SJAX instead of AJAX.
*/
XMLRequest.prototype.post = function (params, body, isAsync) {
    if (!Utils.isDefined(isAsync)) {
        isAsync = true;
    }
    this.xmlHttp.open("POST", Utils.buildQueryString(this.url, params) , isAsync);
    this.xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
    this.xmlHttp.send(body);
}

XMLRequest.prototype.getResponceText = function () {
    if (!this.isComplete()){
        throw new CoreIMSEEException("XMLRequest is not complete or not sent");
    }

    return this.xmlHttp.responseText;
}

XMLRequest.prototype.isComplete = function () {
    return this.xmlHttp.readyState==4 || this.xmlHttp.readyState=="complete";
}

XMLRequest.getXmlHttpObject = function () {
    //TODO add common sniffing code
    //TODO add common event handling
    var objXmlHttp=null

    if (navigator.userAgent.indexOf("Opera")>=0)
    {
        throw CoreIMSEEException("XMLRequest is not supported by Opera"); 
        return;
    }
    if (navigator.userAgent.indexOf("MSIE")>=0)
    { 
        var strName="Msxml2.XMLHTTP"
        if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
        {
            strName="Microsoft.XMLHTTP";
        } 
        try
        { 
            objXmlHttp=new ActiveXObject(strName);
            //objXmlHttp.onreadystatechange=handler; 
            return objXmlHttp;
        } 
        catch(e)
        { 
            throw CoreIMSEEException("Scripting for ActiveX might be disabled. Please enable it."); 
            return; 
        } 
    } 
    if (navigator.userAgent.indexOf("Mozilla")>=0)
    {
        objXmlHttp=new XMLHttpRequest();
        //objXmlHttp.onload=handler;
        //objXmlHttp.onerror=handler; 
        return objXmlHttp;
    }
}

